<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>通知公告添加页面</title>
  <link rel="stylesheet" href="../../../yl/index.css" />
  <!-- 布局样式 -->
  <link rel="stylesheet" href="../../../yl/style.css" />
  <link rel="stylesheet" href="../../../style/wangeditor.css">
  <link rel="stylesheet" href="../../../yl/mobile.css" />
  <link rel="stylesheet" href="../../../yl/easyui.css" />
  <link rel="stylesheet" href="../../../yl/icon.css" />
  <style>
    /* .el-tabs {
      height: 100%;
      overflow: auto;
    } */
    .el-tabs--border-card{
      border: none;
    }
    .el-tabs__content {
      padding: 0 !important;
    }
  </style>
</head>

<body>
  <!-- <div id="app"> -->
  <div class="easyui-navpanel" id="app" v-cloak>
    <header>
      <div class="m-toolbar">
        <div class="m-title">{{action=='Add'?'添加通知公告信息':action=='Modify'?'修改通知公告信息':''}}</div>
      </div>
    </header>
    <div class="easyui-navpanel panel-body panel-body-nobottom panel-body-noborder" style="height: 3000px"
      id="MainTable" ref="MainTable"
      :data-options="JSON.stringify({ 'TableName': 'news', 'form': 'dataForm' ,'primary_key':'News_SerialNumber' })">
      <div style="display: flex;flex-direction: column;height: 100%;">
        <el-tabs v-if="action=='Add'" style="flex-shrink: 0;" v-model="activeName" type="border-card" @tab-click="handleClick">
          <el-tab-pane label="党建组织" name="first"></el-tab-pane>
          <el-tab-pane label="政府组织" name="second"></el-tab-pane>
          <el-tab-pane label="村行政区" name="three"></el-tab-pane>
        </el-tabs>
        <div style="overflow: auto;height: 100%; padding:0 20px 20px;">
          <div class="table_titel">
            <div class="titel">通知公告信息</div>
          </div>
          <el-form :model="dataForm" ref="form" :inline-message="true" style="width: 100%">
            <el-descriptions :column="1" size="large" border>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">通知公告标题</div>
                </template>
                <el-form-item prop="News_Title" :rules="[{ required: true, message: '请输入通知公告标题', trigger: 'blur' }]">
                  <el-input ref="personal_information" v-model="dataForm.News_Title" class="borderless-input"
                    placeholder="请输入通知公告标题" />
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">展示终端选择</div>
                </template>
                <el-select  @change="handleChange" multiple clearable v-model.trim="dataForm.NewsTerminal"
                  placeholder="请输入展示终端选择" filterable style="width: 100%">
                  <el-option v-for="(item,index) in NewsTerminal" :key="index" :label="item"
                    :value="item"></el-option>
                </el-select>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">通知公告类别</div>
                </template>
                <el-form-item prop="News_Type">
                  <el-select :disabled="activeName!='three'" clearable v-model.trim="dataForm.News_Type"
                    placeholder="请选择通知公告类别" filterable style="width: 100%">
                    <el-option v-for="(item,index) in notice" :key="index" :label="item.label"
                      :value="item.value"></el-option>
                  </el-select>
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">所属组织</div>
                </template>
                <el-form-item prop="Party_Organization_Activity_SerialNumber" :rules="[{ required: true, message: '请选择所属组织', trigger: 'change' }]">
                  <el-cascader style="width: 100%;" v-if="activeName=='second'" class="borderless-input" v-model="dataForm.Party_Organization_Activity_SerialNumber"  placeholder="请选择所属组织" :options="organization2" 
                    :props="{ value:'Government_Agencies_SerialNumber', label:'Agensies_Name' ,checkStrictly: true, emitPath:false }"></el-cascader>
                  <el-cascader @change="changeParty" style="width: 100%;" v-if="activeName=='first'" class="borderless-input" v-model="dataForm.Party_Organization_Activity_SerialNumber"  placeholder="请选择所属组织" :options="organization1" 
                    :props="{ value:'Party_Organization_SerialNumber', label:'Party_Organization_Name' ,checkStrictly: true , emitPath:false}"></el-cascader>  
                  <el-cascader style="width: 100%;" v-if="activeName=='three'" class="borderless-input" v-model="dataForm.Party_Organization_Activity_SerialNumber"  placeholder="请选择所属组织" :options="organization3" 
                    :props="{ value:'ProvinceNumber', label:'Province' ,checkStrictly: true , emitPath:false}"></el-cascader>  
                </el-form-item>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">通知公告封面图片</div>
                </template>
                <yl-upload slider v-model="dataForm.News_Image_URL"></yl-upload>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">是否在小程序上展示</div>
                </template>
                <el-select v-model.trim="dataForm.Environment_MicroScreen" placeholder="请选择是否在小程序上展示" filterable
                  style="width: 100%">
                  <el-option v-for="(item,index) in [{label:'是',value:'0'},{label:'否',value:'1'}]" :key="index" :label="item.label" :value="item.value"></el-option>
                </el-select>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">是否在大屏上展示</div>
                </template>
                <el-select v-model.trim="dataForm.Environment_BigScreen" placeholder="请选择是否在大屏上展示" filterable
                  style="width: 100%">
                  <el-option v-for="(item,index) in [{label:'是',value:'0'},{label:'否',value:'1'}]" :key="index" :label="item.label" :value="item.value"></el-option>
                </el-select>
              </el-descriptions-item>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">通知公告内容</div>
                </template>
                <el-form-item prop="News_Content">
                  <yl-text-editor v-model="dataForm.News_Content" placeholder="请输入新闻内容"></yl-text-editor>
                </el-form-item>
              </el-descriptions-item>
            </el-descriptions>
          </el-form>
          <div id="ChildTable">
            <div class="table_titel">
              <div class="titel">公告标签</div>
              <div class="operation">
                <el-button type="primary" size="small" @click="handleAdd('childDataForm')">新增</el-button>
                <el-button type="danger" size="small" @click="handleRemove1('childDataForm')">删除</el-button>
              </div>
            </div>
            <el-form :model="{childDataForm}" ref="form1" :inline-message="true" style="width: 100%">
              <el-descriptions
                :data-options="JSON.stringify({ 'TableName': 'news_mapping_tags', 'form': 'childDataForm', 'ParentTableName': 'news'})"
                :column="3" size="large" border>
                <el-descriptions-item v-for="(item,index) in childDataForm.filter(item => item.Row_Status != '1')"
                  :key="index">
                  <template #label>
                    <div class="cell-item">标签{{index + 1}}</div>
                  </template>
                  <el-form-item :prop="'childDataForm.'+index+'.News_Tag_SerialNumber'"
                    :rules="[{ required: true, message: '请选择新闻标题', trigger: 'change' }]">
                    <yl-cascader v-model="item.News_Tag_SerialNumber"  placeholder="请选择新闻标题" 
                      :options="news_tags.filter(i=>i.News_Tag_SerialNumber==(activeName=='first'?'NT0000000000015':'NT0000000000016'))" 
                      :props="{ value:'News_Tag_SerialNumber', label:'News_Tag' }"></yl-cascader>
                  </el-form-item>
                </el-descriptions-item>
              </el-descriptions>
            </el-form>
            <div class="table_titel">
              <div class="titel">公告附件</div>
            </div>
            <el-descriptions
              :data-options="JSON.stringify({ 'TableName': 'news_picture', 'form': 'childDataForm1', 'ParentTableName': 'news'})"
              :column="2" size="large" border>
              <el-descriptions-item>
                <template #label>
                  <div class="cell-item">附件</div>
                </template>
                <yl-upload ref="ylUpload" drag @success="success" @remove="remove" @clear="clear" :limit="99" :file="fileList"></yl-upload>
              </el-descriptions-item>
            </el-descriptions>
          </div>
        </div>
      </div>
    </div>
    <footer class="botton-ann">
      <el-button @click="goBack">返回</el-button>
      <el-button type="primary" plain @click="handleSubmit" :loading="loading">提交</el-button>
    </footer>
  </div>
</body>
<script src="../../../utils/utils.js"></script>
<script src="../../../config/config.js"></script>
<script src="../../../utils/compressor.js"></script>
<script src="../../../utils/wangeditor.js"></script>
<script src="../../../utils/mixins.js"></script>
<script src="../../../yl/vue.js"></script>
<script src="../../../yl/index.js"></script>
<script src="../../../yl/zh-cn.mjs"></script>
<script src="../../../yl/index.iife.min.js"></script>
<script src="../../../yl/jquery.min.js"></script>
<script src="../../../utils/jquery.cookie.js"></script>
<script src="../../../yl/jquery.easyui.min.js"></script>
<script src="../../../yl/jquery.easyui.mobile.js"></script>
<script src="../../../yl/moment.min.js"></script>
<script src="../../../api/request.js"></script>
<script src="./js/add.js"></script>

</html>